﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace App.Forms
{
    public partial class AccountType : Form
    {
        public AccountType()
        {
            InitializeComponent();
        }

        private void btnCurrent_Click(object sender, EventArgs e)
        {
            Model.CurrentSession.accountType = "current";
            var frm = getCurrentForm();
            if (frm != null)
            {
                this.Hide();
                frm.Closed += (s, args) => this.Close();
                frm.Show();
            }
        }

        private void btnSaving_Click(object sender, EventArgs e)
        {
            Model.CurrentSession.accountType = "saving";
             var frm = getCurrentForm();
             if (frm != null)
             {
                 this.Hide();
                 frm.Closed += (s, args) => this.Close();
                 frm.Show();
             }
        }
        private Form getCurrentForm()
        {
            Form frm;
            switch (Model.CurrentSession.currentOperation)
            {
                case "BalanceEnquiry":
                    frm = new BalanceEnquiry();
                    break;
                case "Cashwithdraw":
                    frm = new Cashwithdraw();
                    break;
                case "ChangePIN":
                    frm = new ChangePIN();
                    break;
                case "Fastcash":
                    frm = new Fastcash();
                    break;
                default:
                    frm = null;
                    break;
            }

            return frm;
        }
    }
}
